/**
 * @description Cookies https://github.com/js-cookie/js-cookie#readme
 * @author Xiaohui Zeng
 * @version 2021/3/15
 * @Email: 1257538859@qq.com
 * @WeChat: badiweier
 */
import Cookies from 'js-cookie'
import setting from '@/setting'

const TokenKey = setting.tokenKey

/**
 * 获取token
 * @param token key
 * @return {*}
 */
export function getToken(token) {
  return Cookies.get(token || TokenKey)
}

/**
 * 设置token
 * @param token key
 * @param value
 * @param option 可设置过期时间等
 * @return {*}
 */
export function setToken(token, value, option = {}) {
  return Cookies.set(token || TokenKey, value, option)
}

/**
 * 删除token
 * @param token key
 * @return {*}
 */
export function removeToken(token) {
  return Cookies.remove(token || TokenKey)
}
